<%--                                                                       --%>
<%-- Copyright (c) 2003 BroadVision, Inc.  All rights reserved.            --%>
<%--                                                                       --%>
<%-- This software is copyrighted. Under the copyright laws, this software --%>
<%-- may not be copied, in whole or in part, without prior written consent --%>
<%-- of BroadVision, Inc. or its assignees. This software is provided      --%>
<%-- under the terms of a license between BroadVision and the recipient,   --%>
<%-- and its use is subject to the terms of that license.                  --%>
<%--                                                                       --%>
<%-- This software may be protected by one or more U.S. and International  --%>
<%-- patents.  Certain applications of BroadVision One-To-One software are --%>
<%-- covered by U.S. patent 5,710,887.                                     --%>
<%--                                                                       --%>
<%-- TRADEMARKS: BroadVision and BroadVision One-To-One are registered     --%>
<%-- trademarks of BroadVision, Inc., in the United States and the         --%>
<%-- European Community, and are trademarks of BroadVision, Inc., in other --%>
<%-- countries.  The BroadVision logo, is a trademark of BroadVision,      --%>
<%-- Inc., in the United States and other countries. Additionally, IONA    --%>
<%-- and Orbix are trademarks of IONA Technologies, Ltd.  RSA, MD5, and    --%>
<%-- RC2 are trademarks of RSA Data Security, Inc.                         --%>
<%--                                                                       --%>


<%@ taglib uri="/WEB-INF/struts-html.tld" prefix="html" %>
<%@ taglib uri="/WEB-INF/struts-bean.tld" prefix="bean" %>
<%@ taglib uri="/WEB-INF/struts-logic.tld" prefix="logic" %>

<script language=JavaScript>
function confirmDeleteDelegation()
{
   // javascript function to check time
   if (confirm('<bean:message bundle="appCommonRes" key="ca.confirm.delete.delegation"/>'))
   {
      return true;
   }
   else
   {
      return false;
   }
}

function confirmStopDelegation()
{
   // javascript function to check time
   if (confirm('<bean:message bundle="appCommonRes" key="ca.confirm.stop.delegation"/>'))
   {
      return true;
   }
   else
   {
      return false;
   }
}

</script>

<table class="zoneFive" width="100%" border="0" cellspacing="0" cellpadding="0" summary="content area">
  <tr>
    <td valign="top" width="100%">
        <div class="app_pageTitle">
          <bean:message bundle="appCommonRes" key="ca.delegation.listTitle"/>
        </div> 
        
        <div class="app_pageSubtitle">
          <span class="left">
            <bean:message bundle="appCommonRes" key="ca.delegation.outbound"/>
          </span>
          <span class="right">
          <html:form action="/ca/delegationNew.do">
            <html:submit styleClass="titleButton">
                <bean:message bundle="appCommonRes" key="button.addNewDelegation"/>
            </html:submit>    
          </html:form>
          </span>
        </div>  
        
				<div class="blockWrap">
				  
        <table class="dataTable" border="0" cellspacing="1" cellpadding="2" summary="task delegations table" width="100%">
          <tr class="listHeader">
            <th id="DelegateTo" align="left"><bean:message bundle="appCommonRes" key="ca.delegateTo"/></th>
            <th id="Start" align="left"><bean:message bundle="appCommonRes" key="ca.start"/></th>
            <th id="End" align="left"><bean:message bundle="appCommonRes" key="ca.end"/></th>
            <th id="Actions" align="left"><bean:message key="cs.actions"/></th>
          </tr>
          
        <%-- list the outbound delegations --%>
          <bean:size id="outlistCount" name="caDelegationListView" property="outboundList"/>
                    
          <logic:equal name="outlistCount" value="0">
            <tr class="listOdd">
              <td colspan="4" align="center">
                <bean:message bundle="appCommonRes" key="ca.delegation.nooutbound"/>
              </td>
            </tr>
          </logic:equal>
          <%-- list the outbound delegations --%>
          <logic:present name="caDelegationListView" property="outboundList">
          <logic:iterate id="oneDelegation" name="caDelegationListView"
                         property="outboundList" indexId="index1" >
                         
             <tr class='<%=index1.intValue() %2 == 0 ? "listEven" : "listOdd"%>'> 
          
                <td headers="DelegateTo">
                  <bean:write name="oneDelegation" property="fullName"/>
                </td>
                <td headers="Start">
                  <bean:write name="oneDelegation" property="startTime" formatKey="format.datetime.medium"/>&nbsp;
                </td>
                <td headers="End">
                  <bean:write name="oneDelegation" property="endTime" formatKey="format.datetime.medium"/>&nbsp;
                </td>
                <td nowrap align="left" headers="Actions">
                  
                  <html:link page="/ca/delegationEdit.do" paramName="oneDelegation" 
                             paramId="delegationOid" paramProperty="oid">
                    <html:img page="/ca/images/action/icon_edit.gif" 
                              styleClass="actionIcon" width="15" height="15" 
                              border="0" altKey="cs.image.alt.edit" />
                  </html:link>
                  <%-- the delegation can be only be deleted if it has not started yet --%>
                  <logic:equal name="oneDelegation" property="started" value="false"> 
                  <html:link page="/ca/delegationDelete.do" paramName="oneDelegation" paramId="delegationOid" paramProperty="oid" onclick="return confirmDeleteDelegation()">
                    <html:img page="/ca/images/action/icon_delete.gif" 
                              width="15" height="15" border="0" 
                              altKey="cs.image.alt.delete" 
                              styleClass="actionIcon"/>
                  </html:link>
                  </logic:equal> 
               
                  <%-- the delegation can be stopped only if it has already started --%>
                  <logic:equal name="oneDelegation" property="started" value="true"> 
                  <html:link page="/ca/delegationStop.do" paramName="oneDelegation" paramId="delegationOid" paramProperty="oid" onclick="return confirmStopDelegation()">
                    <html:img page="/ca/images/action/icon_stop.gif" width="15" 
                              height="15" border="0" altKey="cs.image.alt.stop" 
                              styleClass="actionIcon"/>
                  </html:link>
                  </logic:equal>
              
                </td>
              </tr>
            </logic:iterate>
            </logic:present>
          </table>
        </div>
				
				<br>
        
				<div class="app_pageSubtitle">
          <span class="left">
            <bean:message bundle="appCommonRes" key="ca.delegation.inbound"/>
          </span>
        </div>  
        
				<div class="blockWrap">  
        <table class="dataTable" border="0" cellspacing="1" cellpadding="2" summary="task delegations table" width="100%">
          <tr class="listHeader">
            <th id="DelegatedFrom" align="left"><bean:message bundle="appCommonRes" key="ca.from"/></th>
            <th id="Start" align="left"><bean:message bundle="appCommonRes" key="ca.start"/></th>
            <th id="End" align="left"><bean:message bundle="appCommonRes" key="ca.end"/></th>
          </tr>
          
            
            <%-- list the inbound delegations --%>
            <bean:size id="inlistCount" name="caDelegationListView" property="inboundList"/>
            
            <logic:equal name="inlistCount" value="0">
              <tr class="listOdd">
                <td colspan="3" align="center">
                  <bean:message bundle="appCommonRes" key="ca.delegation.noinbound"/>
                </td>
              </tr>
            </logic:equal>
            <logic:present name="caDelegationListView" property="inboundList">
            <logic:iterate id="oneDelegation" name="caDelegationListView"
                         property="inboundList" indexId="index2" >
                         
             <tr class='<%=index2.intValue() %2 == 0 ? "listEven" : "listOdd"%>'> 
          
                <td headers="DelegatedFrom">
                  <bean:write name="oneDelegation" property="fullName"/>
                </td>
                <td headers="Start">
                  <bean:write name="oneDelegation" property="startTime" formatKey="format.datetime.medium"/>
                </td>
                <td headers="End">
                  <bean:write name="oneDelegation" property="endTime" formatKey="format.datetime.medium"/>
                </td>
              </tr>
            </logic:iterate>
            </logic:present>
        </table>
        </div>
    </td>
  </tr>
</table>
